package org.azmat.demojpa.SQL.JDBC.Service;

import org.azmat.demojpa.SQL.JDBC.Entity.Student;
import org.azmat.demojpa.SQL.JDBC.Repository.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentService {

    @Autowired
    private StudentRepository studentRepository;

    public int addStudent(Student student) {
        return studentRepository.addStudent(student);
    }

    public int deleteStudent(int id) {
        return studentRepository.deleteStudent(id);
    }

    public int updateStudent(Student student) {
        return studentRepository.updateStudent(student);
    }

    public Student getStudentById(int id) {
        return studentRepository.getStudentById(id);
    }

    public List<Student> findAll() {
        return studentRepository.getAllStudents();
    }
}

